package com.example.springbootdemo.config;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;


@Aspect
@Configuration
@Slf4j
public class AopConfig {
    public AopConfig() {
        log.info("spring 初始化 AopConfig");
    }

    //定义统一的切入点
    @Pointcut("execution ( * com.example.springbootdemo.controller.UserController.*(..))")
    //@Pointcut(value = "@annotation(com.example.springbootdemo.controller.UserController.*(..))")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void pointCutBefore(JoinPoint point) {
        log.info("pointCutBefore start {}", point.getArgs());
    }

}
